package com.ck.ck_back.utils;

import com.ck.ck_back.dao.LikeCommentMapper;
import com.ck.ck_back.pojo.LikeComment;
import com.ck.ck_back.service.likecommentservice;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.scheduling.quartz.QuartzJobBean;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Slf4j
public class likecommentTask extends QuartzJobBean  {
    @Resource
    private likecommentservice likecommentserviceimpl;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
            List<LikeComment> likeComments = likecommentserviceimpl.getLikedDataFromRedis();
        log.info(String.valueOf(likeComments));

        if (likeComments.size()>0){
            likecommentserviceimpl.deal_withdata(likeComments);
        }else {
            log.info("暂无数据需要评论点赞数据存储");
        }
    }
}
